import { grabbleMusicScoreData } from '../../../config/api'
import { MusicScore } from '../../../proto/proto';
import { __getPageScrollY } from '../../../config/utils'
/**
 * 
 * @param {*} type  action 类型 
 * @param {*} data  action 数据  对象形式
 */
export const commonAction = (type, data) => ({
	type,
	data
});
// 获取搜索曲谱
export const acquireGrabbleMusicScoreData = (state) => {
	return async (dispatch) => {
		/**
		 * 
		 * @param {int} type  	0 默认 1 吉他课 2 尤克里里
		 * @param {int} state   1 热门 2 最新
		 * @param {int} page    页码
		 * @param {int} size    一页几条
		 * @param {string} text    搜索文本
		 */
		let data = await grabbleMusicScoreData(MusicScore,'MusicScore.SearchScoreReqMsg','MusicScore.MusicScoreResMsg',state['type'],state['state'],state['page'],state['size'],state['text']);
		__getPageScrollY(0);
		dispatch(commonAction(state['actionType'],data));
	}
}

